<!DOCTYPE html>
<html>
    <head>
        <meta content='' name='description'>
        <meta charset='UTF-8'>
        <meta content='True' name='HandheldFriendly'>
        <meta content='width=device-width, initial-scale=1.0' name='viewport'>
        <title><?php echo $title ?> - 管理后台 - <?php echo $settings['site_name'] ?></title>
        <?php $this->load->view('common/header-meta'); ?>
    </head>
    <body id="startbbs">
        <?php $this->load->view('common/header'); ?>

        <div class="container">
            <div class="row">
                <?php $this->load->view('common/sidebar'); ?>
                <div class="col-md-10">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <ol class="breadcrumb">
                                <li><a href="<?php echo site_url('admin/login'); ?>">管理首页</a></li>
                                <li class="active">用户列表</li>
                            </ol>
                            <ul class="nav nav-pills">
                                <li<?php if ($act == 'index' || $act == 'search') { ?> class="active"<?php } ?>><a href="<?php echo site_url('admin/info_art/index'); ?>">信息列表</a></li>
                                <li<?php if ($act == 'cateindex' || $act == 'cateedit' || $act == 'cateadd') { ?> class="active"<?php } ?>><a href="<?php echo site_url('admin/info_art/cate/index'); ?>">信息分类</a></li>
                            </ul>
                            <?php if ($act == 'index' || $act == 'search') { ?>
                                <table class='table table-hover table-condensed'>
                                    <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>分类</th>
                                            <th>标题</th>
                                            <th>上传者</th>
                                            <th>浏览次数</th>
                                            <th>上传时间</th>
                                            <th>是否发布</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php foreach ($info_list as $v) { ?>
                                            <tr id='user_<?php echo $v['id'] ?>'>
                                                <td>
                                                    <?php echo $v['id'] ?>
                                                </td>
                                                <td>
                                                    <strong><?php echo $v['cate_name']; ?></strong>
                                                </td>

                                                <td>	<strong class='green'><a target="prevview" href="<?php echo site_url('infoArt/detail?artid=' . $v['id']); ?>"><?php echo $v['title'] ?></a>  <?php if ($v['ishome'] == '1') echo '<span class="badge badge-info">置顶</span>'; ?></strong>
                                                </td>
                                                <td>
                                                    <?php echo $v['author'] ?>
                                                </td>
                                                <td>
                                                    <?php echo $v['viewtimes'] ?>
                                                </td>
                                                <td>
                                                    <?php echo date('Y/m/d', $v['addtime']); ?>
                                                </td>
                                                <td>
                                                    <?php
                                                    if ($v['status'] == 1) {
                                                        echo "已发布";
                                                    } else {
                                                        echo "未发布";
                                                    }
                                                    ?>
                                                </td>
                                                <td class='center'>
                                                    <a href="<?php echo site_url('admin/info_art/edit/' . $v['id']); ?>" class="btn btn-primary btn-sm">修改</a>
                                                    <a href="<?php echo site_url('admin/info_art/del/' . $v['id']); ?>" class="btn btn-sm btn-danger">删除</a>
                                                </td>
                                            </tr>
                                        <?php } ?>
                                    </tbody>
                                </table>
                                <?php if (@$pagination) { ?>
                                    <ul class='pagination'>
                                        <?php if ($act == 'index') echo $pagination ?>
                                    </ul>
                                <?php } ?>
                                <ul class='pagination'>
                                    <?php echo form_open('admin/info_art/search', array('class' => 'form-inline')); ?>
                                    <input id="username" class="form-control" name="username" placeholder="请输入关键字查询" type="text" />
                                    <button type="submit" name="commit" class="btn btn-default">搜索</button>
                                    <a href="<?php echo site_url('admin/info_art/edit/'); ?>" class="btn btn-default">新增信息</a>
                                    </form>

                                </ul>
                            <?php } ?>
                            <?php if ($act == 'cateindex') { ?>
                                <table class='table table-hover'>
                                    <thead>
                                        <tr>
                                            <th></th>
                                            <th>分类名称</th>
                                            <th>排序</th>
                                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php foreach ($cate_list as $v) { ?>
                                            <tr class='highlight' id='cate_<?php echo $v[' id ']; ?>'>
                                                <td>
                                                    <?php echo $v['id'] ?>
                                                </td>
                                                <td>
                                                    <strong><?php echo $v['cate_name']; ?></strong>
                                                </td>
                                                <td>
                                                    <strong class='green'><?php echo $v['o'] ?></strong>
                                                </td>
                                                <td>
                                                    <?php
                                                    if ($v['status'] == 1) {
                                                        echo '已启用';
                                                    } else {
                                                        echo "未发布";
                                                    }
                                                    ?>
                                                </td>
                                                <td>
                                                    <a href="<?php echo site_url('admin/info_art/cate/edit/' . $v['id']); ?>" class="btn btn-primary btn-sm">修改</a>
                                                </td>
                                            </tr>
                                        <?php } ?>
                                    </tbody>
                                </table>
                                <a class="btn btn-default" href="<?php echo site_url('admin/info_art/cate/add'); ?>" class="btn">新增分类</a>
                            <?php } ?>
                            <?php if ($act == 'cateadd') { ?>
                                <div>
                                    <form accept-charset="UTF-8" action="<?php echo site_url('admin/info_art/cate/edit'); ?>" class="simple_form form-horizontal" id="edit_user_2" method="post" novalidate="novalidate">
                                        <input type="hidden" name="<?php echo $csrf_name; ?>" value="<?php echo $csrf_token; ?>">
                                        <div class="form-group">
                                            <label class="col-md-3 control-label" for="cate_name">分类名称</label>
                                            <div class="col-md-5">
                                                <input class="form-control" id="cate_name" name="cate_name" size="50" type="text" value="<?php echo $cate_info['cate_name'] ?>" />
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label" for="o">排序</label>
                                            <div class="col-md-5">
                                                <input class="form-control" id="o" name="o" size="50" type="text" value="<?php echo $cate_info['o'] ?>" />
                                            </div>
                                        </div>
                                        <div class="form-group string optional">
                                            <label class="col-md-3 control-label" for="status">是否启用</label>
                                            <div class="col-md-5">
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" <?php if ($cate_info['status'] == 0) { ?> checked="checked" <?php } ?> id="status0" value="0"> 未启用
                                                </label>
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" <?php if ($cate_info['status'] == 1) { ?> checked="checked" <?php } ?> id="status1" value="1"> 已启用
                                                </label>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-offset-3 col-sm-9">
                                                <button type="submit" name="commit_edit" value=1 class="btn btn-primary">保存</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            <?php } ?>
                            <?php if ($act == 'cateedit') { ?>
                                <div class='cell'>
                                    <form accept-charset="UTF-8" action="<?php echo site_url('admin/info_art/cate/edit/' . $cate_info['id']); ?>" class="simple_form form-horizontal" id="edit_user_1" method="post" novalidate="novalidate">
                                        <input type="hidden" name="<?php echo $csrf_name; ?>" value="<?php echo $csrf_token; ?>">
                                        <input type="hidden" name="id" value="<?php echo $cate_info['id']; ?>">
                                        <div class="form-group">
                                            <label class="col-md-3 control-label" for="cate_name">分类名称</label>
                                            <div class="col-md-5">
                                                <input class="form-control" id="cate_name" name="cate_name" size="50" type="text" value="<?php echo $cate_info['cate_name'] ?>" />
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label" for="o">排序</label>
                                            <div class="col-md-5">
                                                <input class="form-control" id="o" name="o" size="50" type="text" value="<?php echo $cate_info['o'] ?>" />
                                            </div>
                                        </div>
                                        <div class="form-group string optional">
                                            <label class="col-md-3 control-label" for="status">是否启用</label>
                                            <div class="col-md-5">
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" <?php if ($cate_info['status'] == 0) { ?> checked="checked" <?php } ?> id="status0" value="0"> 未启用
                                                </label>
                                                <label class="radio-inline">
                                                    <input type="radio" name="status" <?php if ($cate_info['status'] == 1) { ?> checked="checked" <?php } ?> id="status1" value="1"> 已启用
                                                </label>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-offset-3 col-sm-9">
                                                <button type="submit" name="commit_edit" value=1 class="btn btn-primary">更新分类</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            <?php } ?>
                        </div>
                    </div>
                </div><!-- /.col-md-8 -->

            </div><!-- /.row -->
        </div><!-- /.container -->

        <?php $this->load->view('common/footer'); ?>
    </body></html>